package com.qch.boot;

import com.qch.client.RPCConsumer;
import com.qch.json.RpcRequest;
import com.qch.service.UserService;

/**
 * @Author qch
 * @Date 2021/1/28
 */
public class ConsumerBoot {
    //参数定义
    private static final String PROVIDER_NAME="UserService#sayHello#";
    public static void main(String[] args) throws InterruptedException {
     /*   //1.创建代理对象
        UserService userService = (UserService) RPCConsumer.createProxy(UserService.class, PROVIDER_NAME);
        //2.循环给服务器写数据
        while (true){
            String result = userService.sayHello("are you ok");
            System.out.println(result);
            Thread.sleep(2000);
        }*/

        //1.创建代理对象
        UserService userService = (UserService) RPCConsumer.createProxy(UserService.class);
        //2.循环给服务器写数据
        //String result = userService.sayHello("success");
        //System.out.println(result);
       while (true){
            String result = userService.sayHello("success");
            Thread.sleep(5000);
        }
    }
}
